﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.ObjectConverter;
using JXT.PrimaryKey.Batman.Domain.UserSystem.Models;
using Security = JXT.PrimaryKey.Batman.Core.Security;

namespace JXT.PrimaryKey.Batman.WcfService.Services.Converters.UserSystem
{
    public class AuthorityConverter : AutoConvertableBase<Authority, Security.Authority, AuthorityConverter>, IConvertable<Authority, Security.Authority>
    {
        protected override void BuildExpressionConverter(IObjectConverter<Authority, Security.Authority> converter)
        {
            base.BuildExpressionConverter(converter);
            converter.Add(e => e.Type, e => e.Type, e => (Security.AuthorityType)((byte)e));
        }

        protected override void BuildExpressionBackConverter(IObjectConverter<Security.Authority, Authority> backConverter)
        {
            base.BuildExpressionBackConverter(backConverter);
            backConverter.Add(e => e.Type, e => e.Type, e => (AuthorityType)((byte)e));
        }
    }
}
